#include <iostream>
#include <stdlib.h>

using namespace std;

int procduce(int x, int y)
{
	int max = abs(x) > abs(y) ? abs(x) : abs(y);
	int all = (2 * max + 1) * (2 * max + 1);
	int res;
	if(y == -1 * max)
		res = all - (max - x);
	else if(x == -1 * max)
		res = all - (2 * max + 1) - (y + max - 1);
	else if(y == max)
		res = all - (4 * max + 1) - (x + max - 1);
	else if(x == max)
		res = all - (6 * max + 1) - (max - 1 - y);
	return res;
}

int main()
{
	cout<<procduce(-1 , -1)<<endl;
	cout<<procduce(-1 , 0)<<endl;
	cout<<procduce(0 , 1)<<endl;
	cout<<procduce(1 , 0)<<endl;
}
